/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AsignarProfesor.java
 *
 * Created on 17/02/2011, 11:21:54 AM
 */
package Pantallas;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author Reinaldo Carvallo
 */
public class AsignarProfesor extends javax.swing.JFrame {

    /** Creates new form AsignarProfesor */
    public AsignarProfesor() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        txtTitulo = new javax.swing.JTextField();
        txtNombre = new javax.swing.JTextField();
        txtCedula = new javax.swing.JTextField();
        btnAceptar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(null);

        jLabel1.setText("Asignar Profesor");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(230, 10, 110, 30);

        jLabel2.setText("Cedula");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(120, 110, 110, 20);

        jLabel3.setText("Nombre y Apellido");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(70, 140, 140, 30);

        jLabel4.setText("Titulo Academico");
        getContentPane().add(jLabel4);
        jLabel4.setBounds(70, 180, 110, 30);
        getContentPane().add(txtTitulo);
        txtTitulo.setBounds(210, 190, 210, 20);
        getContentPane().add(txtNombre);
        txtNombre.setBounds(210, 150, 210, 20);
        getContentPane().add(txtCedula);
        txtCedula.setBounds(210, 110, 210, 20);

        btnAceptar.setText("Aceptar");
        btnAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAceptarActionPerformed(evt);
            }
        });
        getContentPane().add(btnAceptar);
        btnAceptar.setBounds(170, 270, 150, 23);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-500)/2, (screenSize.height-360)/2, 500, 360);
    }// </editor-fold>//GEN-END:initComponents

    private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAceptarActionPerformed
        // TODO add your handling code here:
        if (txtCedula.getText().equals("") || txtNombre.getText().equals("") || txtTitulo.getText().equals(""))
        {
                   JOptionPane.showMessageDialog(new JFrame(),"Debe Introducir todos los datos","Aviso",JOptionPane.CANCEL_OPTION);

        }
        else{

        MenuPrincipal.p1.setCedula(txtCedula.getText());
        MenuPrincipal.p1.setNombre_apellido(txtNombre.getText());
        MenuPrincipal.p1.setTituloAcademico(txtTitulo.getText());

        JOptionPane.showMessageDialog(new JFrame(),"Profesor Asignado Exitosamente","Aviso",JOptionPane.CANCEL_OPTION);
        dispose();
        }
    }//GEN-LAST:event_btnAceptarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new AsignarProfesor().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAceptar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JTextField txtCedula;
    private javax.swing.JTextField txtNombre;
    private javax.swing.JTextField txtTitulo;
    // End of variables declaration//GEN-END:variables
}
